package homework;

import java.util.ArrayList;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        list.add("鸡你");
        list.add("实在太美");
        list.add("ohbaby");
        list.add("实在是太美");
        list.add("多一眼就会爆炸");
        list.add("近一点快被融化");
        System.out.println("list:"+list);
        System.out.println(list.get(4));
        String old=list.set(1,"你干嘛");//返回替换的元素
        System.out.println(old);
        System.out.println("list:"+list);
        String data=list.remove(2);//返回被删除的元素
        System.out.println(data);
        System.out.println("list:"+list);
        list.add(2,"哇，真的是你啊");
        System.out.println("list:"+list);

    }
}
